

#include "stdio.h"
#include "sys/types.h"
#include "pthread.h"
#include "unistd.h"


void* thread_start(void *argv)
{
    pthread_t tid;
    pid_t pid;

    tid = pthread_self();
    pid = getpid();

    printf("children, tid is %lu, pid is %d\n", tid, pid);

    return (void *)0;
}

int main()
{
    pthread_t tid;
    pid_t   pid;
    int ret;

    tid = pthread_self();
    pid = getpid();

    printf("parent, tid is %lu, pid is %d\n", tid, pid);

    ret = pthread_create(&tid, NULL, thread_start, "new thread");

    if(ret != 0){
        printf("pthread create failed\n");
        return 0;
    }

    sleep(3);
}
